package com.ruoyi.system.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.core.domain.entity.Course;
import com.ruoyi.system.mapper.CourseMapper;
import com.ruoyi.system.service.ICourseService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;



/**
 * 课程 业务层处理
 * */
@Service
public class CourseServiceImpl implements ICourseService {
    private static final Logger log = LoggerFactory.getLogger(CourseServiceImpl.class);
    @Autowired
    private CourseMapper courseMapper;

    /**
     *  新增课程
     *  @param course 课程信息
     *  @return 结果
     * */
    @Override
    @Transactional
    public int insertCourse(Course course) {
        int rows = courseMapper.insertCourse(course);
        return rows;
    }
    /**
     *  查询课程详情
     *  @param courseId 课程id
     *  @return 结果
     * */
    public Course selectCourseById(String courseId) {
        return courseMapper.selectCourseById(courseId);
    }
    /**
     *  查询课程列表
     *  @param course 课程信息
     *  @return 结果
     * */
    @Override
    public List<Course> selectCourseList(Course course) {
        return courseMapper.selectCourseList(course);
    }
    /**
     *  更新课程
     *  @param course 课程信息
     *  @return 结果
     * */
    public int updateCourse(Course course) {
        return courseMapper.updateCourse(course);
    }
    /**
     *  删除课程
     *  @param courseId 课程信息
     *  @return 结果
     * */
    @Transactional
    public int deleteCourseById(Long courseId) {
        return courseMapper.deleteCourseById(courseId);
    }
    public int deleteCourseByIds(Long[] courseIds) {
        return courseMapper.deleteCourseByIds(courseIds);
    }

}
